<template>
	<div class="news">
		<header class="navigation">
			
			<div @click="retreat"><img src="../assets/rightbut.png"></div>
			<div>消息</div>
			<div></div>
			
		</header>
		<!--消息内容-->
		<div class="newscontent">
			<div class="newscontent_d" v-for="item in newslist" @click="newson(item.id,item.type,item.name)">
				<img :src="item.icon">
				{{item.name}}
			</div>
		</div>
	</div>
</template>

<script>
	import { Toast } from 'mint-ui';
	import { BaseUrl } from '../Baseurl/common.js';
	export default{
		data(){
			return{
				token:'',
				newslist:[],
			}
		},
		created(){
			this.token = localStorage.getItem('token');
			//系统消息
			var url = BaseUrl + 'msg/type?appId=wap' + '&token=' + this.token;
			this.$http.post(url).then(res=>{
//				console.log(res.data.data);
				if(res.data.code == '10000'){
					this.newslist = res.data.data;
				}else{
					Toast({
						message: res.data.msg,
						position: 'middle',
						duration: 3000
					})
				}
			}).catch(res=>{
				Toast({
					message: "网络异常",
					position: 'middle',
					duration: 3000
				})
			})
		},
		methods:{
			//导航退后
			retreat:function(){
				window.history.go(-1);
			},
			newson:function(id,type,name){
				if(name == '客户消息'){
					window.location.href = 'http://chat56.live800.com/live800/chatClient/chatbox.jsp?companyID=944015&configID=155782&jid=9694995927'
				}else{
					this.$router.push({
						path:'/newsdetails?id=' + id + '&type=' + type
					})
				}
			}
		}
	}
</script>

<style scoped="scoped">
	html,body,.news{
		width: 100%;
		height: 100%;
		background: #ffffff;
	}
	.news{
		background: #eeeeee;
	}
	.navigation{
		height: 1rem;
		background: #fff;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 0.24rem;
		color: #323232;
		font-size: 0.36rem;
		margin-bottom: 0.2rem;
	}
	.navigation img{
		width: 0.2rem;
		height: 0.36rem;
		display: block;
	}
	.newscontent{
		background: #fff;
	}
	.newscontent_d{
		display: flex;
		align-items: center;
		padding: 0.4rem 0;
		font-family: PingFangSC-Regular;
		font-size: 0.3rem;
		color: #333333;
		letter-spacing: 0;
		border-bottom: 1px solid #E2E2E2;
	}
	.newscontent_d img{
		width: 0.9rem;
		height: 0.9rem;
		margin:  0 0.3rem 0 0.2rem;
		border-radius: 50%;
	}
</style>